#pragma once
#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <fstream>
#include <string>
using namespace std;
class Shader
{
public:
	Shader() {};
	~Shader();
	Shader(const char* vertexShaderPath, const char* fragmentShaderPath);

	void setProgramUse(bool use) {
		if (use)
			glUseProgram(program);
		else
			glUseProgram(0);
	}

	GLuint getProgram() {
		return program;
	}


private:
	bool openShaderFile(const char* vertexShaderPath, const char* fragmentShaderPath);

	void getShaderSource();

	bool compileShaderSource();

	bool linkShaderProgram();

private:
	ifstream vertexShaderFile;
	ifstream fragmentShaderFile;

	string vertexShaderSource;
	string fragmentShaderSource;

	GLuint vertexShader;
	GLuint fragmentShader;

	GLuint program;
	int success;

	char errorMsg[1024] = { 0 };
};

